﻿<businessLogic:DialogBase x:Class="PDM.Client.Windows.SettingsWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:settings="clr-namespace:PDM.Client.Settings"
    xmlns:businessLogic="clr-namespace:PDM.BusinessLogic"
    Title="Settings" Height="340" Width="400" Closed="WindowBase_Closed"
    >
    <Window.Resources>
        <settings:UserSettings x:Key="Settings" />
    </Window.Resources>

    <Grid Margin="5, 0, 5, 0" DataContext="{StaticResource Settings}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="{StaticResource DefaultMarginBig}" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="{StaticResource DefaultMarginBig}" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TabControl Grid.Row="0" Grid.Column="0">
            <TabItem Header="Folders">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Content="Add folders where you store your documents" />
                    
                    <ListBox Grid.Row="2" IsSynchronizedWithCurrentItem="True" VirtualizingStackPanel.IsVirtualizing="True"
                             ItemsSource="{Binding Path=Default.Folders, Mode=TwoWay}" Name="foldersListBox" 
                              SelectionMode="Single" VerticalContentAlignment="Stretch">                        
                    </ListBox>

                    <StackPanel Margin="0, 0, 0, 0" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center">
                        <Button Content="Add" Width="{StaticResource DefaultButtonWidth}" Margin="0, 0, 0, 0" Click="addFolderButton_Click" />
                        <Button Content="Remove" Width="{StaticResource DefaultButtonWidth}" Margin="10, 0, 0, 0" Click="removeFolderButton_Click" />
                    </StackPanel>
               </Grid>
            </TabItem>
            <TabItem Header="File types">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Content="Select file types for scanning" />
                    <TextBox Grid.Row="1" Text="" x:Name="FileTypeTextBox" />

                    <ListBox Grid.Row="3" IsSynchronizedWithCurrentItem="True" VirtualizingStackPanel.IsVirtualizing="True"
                             ItemsSource="{Binding Path=Default.FileTypes, Mode=TwoWay}" Name="fileTypesListBox" 
                              SelectionMode="Single" VerticalContentAlignment="Stretch">
                    </ListBox>

                    <StackPanel Margin="0, 0, 0, 0" Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Center">
                        <Button Content="Add" Width="{StaticResource DefaultButtonWidth}" Margin="0, 0, 0, 0" Click="addFileTypeButton_Click" />
                        <Button Content="Remove" Width="{StaticResource DefaultButtonWidth}" Margin="10, 0, 0, 0" Click="removeFileTypeButton_Click" />
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem Header="Templates">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="{StaticResource DefaultMarginSmall}" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Content="Select template file" />                    

                    <ListBox Grid.Row="2" IsSynchronizedWithCurrentItem="True" VirtualizingStackPanel.IsVirtualizing="True"
                             ItemsSource="{Binding Path=Default.Templates, Mode=TwoWay}" Name="templatesListBox" 
                              SelectionMode="Single" VerticalContentAlignment="Stretch">
                    </ListBox>

                    <StackPanel Margin="0, 0, 0, 0" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center">
                        <Button Content="Add" Width="{StaticResource DefaultButtonWidth}" Margin="0, 0, 0, 0" Click="addTemplateButton_Click" />
                        <Button Content="Remove" Width="{StaticResource DefaultButtonWidth}" Margin="10, 0, 0, 0" Click="removeTemplateButton_Click" />
                    </StackPanel>
                </Grid>
            </TabItem>            
        </TabControl>

        <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Save" Width="{StaticResource DefaultButtonWidth}" Margin="0, 0, 0, 0" HorizontalAlignment="Right" Click="SaveButton_Click" />
            <Button Content="Cancel" Width="{StaticResource DefaultButtonWidth}" Margin="10, 0, 10, 0" HorizontalAlignment="Right" Click="CancelButton_Click" />
        </StackPanel>
    </Grid>
</businessLogic:DialogBase>
    
